<?php

namespace app\admin\validate;

use app\admin\model\Admin;
use app\admin\model\Menu;
use think\Validate;

class RoleForm extends Validate
{
    protected $rule = [
        'name|角色名'  =>  'require',
        'is_active|是否开启'  =>  'require|in:0,1'
    ];
    public function add($data){
        if( Admin::addRold($data['name'],$data['is_active'],$data['remarks'])){
            return ['code'=>0,'msg'=>'添加成功!'];
        }else{
            return ['code'=>20011,'msg'=>'添加失败!'];
        }
    }
}